-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Trace IDs and metadata to log lines #648
Conversation
Just checking this is what you meant as these ids are the same? |
@erikfuller oops you're correct. I've updated my description. I tried looking through my logs to see if I Can find a better example but I have very low traffic in my dev env so I don't see a lot of overlapping actions. However I can confirm that the uuid is correctly generated as unique per action
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @shulin-sq, being able to better correlate logs will really help with debugging. I have a few comments and requests, please just let me know if anything is unclear and feel free to push back if you think I've got something wrong.
Note there are also a few conflicts after merging in the tls-passthrough PR, please resolve those as well. There shouldn't be any further PRs coming through before this one so this should be a one-time conflict resolution.
test/go.mod
Outdated
go 1.21 | ||
|
||
toolchain go1.22.1 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove this, this is something that got added by my IDE
a7c6e7d
to
12e6131
Compare
728309a
to
4a65bf8
Compare
@erikfuller I updated the PR, please let me know if there are further requested modifications |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for putting this together. Look forward to seeing this in action!
e283318
to
0de1bcb
Compare
0de1bcb
to
690e17f
Compare
Downgrade back to go 1.20
What type of PR is this?
feature (?)
Which issue does this PR fix:
#603
What does this PR do / Why do we need it:
This PR adds the ability to track trace id and metadata to all log lines. It also changes the log interface so that in most cases, developers are forced to add a context instance to the log line.
The previous PR was here: #624 but was based on an older release version. I decided to recreate the branch on top of main.
This PR also addresses some of the comments brought up in the previous PR
Additional resources:
Testing done on this change:
ran
and also ran a built version in my test EKS cluster.
Automation added to e2e:
no
Will this PR introduce any new dependencies?:
no
Will this break upgrades or downgrades. Has updating a running cluster been tested?:
no, will not break since it's a change to do with the logging interface
Does this PR introduce any user-facing change?:
no
How to use:
For all Reconcile I have added something like this at the beginning of the method
this should produce a log line like so:
Something to do next, but not as part of this PR as I do not want to conflict with future changes that want to add more log lines is that for errors you can add why a reconcile failed as part of the metadata.
for example in TargetGroupPolicyController you can change this logic to
and then the failed_reason will show up in the
[ACTION_RECONCILE_END]
message.You can still keep using the original logger as it's exposed as InnerLogger in TracedLogger.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.